<include file="public@header"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-page-header">
            <div class="layui-card">
                <div class="layui-page-header-content">
                    <div class="layui-card-body">
                        <div class="layui-ui-page-header-title" >
                            文章分类<span class="layui-badge-rim page-content">设置网站的数据参数及其它设置</span>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title">
                            <li><a href="{:url('AdminCategory/index')}">分类管理</a></li>
                            <li class="layui-this"><a href="{:url('AdminCategory/add')}">添加分类</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-page-content">
            <div class="layui-row layui-col-space8 layui-tab">
                <div class="layui-col-md2">
                    <div class="layui-card">
                        <div class="layui-card-header">添加分类</div>
                        <ul class="layui-ivu-menu" id="tabHeader">
                            <li class="layui-this"><i class="icon-icon layui-icon-md-settings"></i>基本属性</li>
                            <!-- <li ><i class="icon-icon layui-icon-md-code-working"></i>SEO设置</li>
                            <li ><i class="icon-icon layui-icon-ios-color-palette"></i>模板设置</li> -->
                        </ul>
                    </div>
                </div>
                <div class="layui-col-md10">
                    <div class="layui-card">
                        <div class="layui-card-header">编辑内容</div>
                        <div class="layui-card-body">
                            <form class="layui-form js-ajax-form" action="{:url('AdminCategory/addPost')}" method="post">
                                <div class="layui-tab-content" id="tabBody">
                                    <div class="layui-tab-item layui-show">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-parent"><span class="form-required">*</span>上级</label>
                                            <div class="layui-input-block">
                                                <select class="layui-input" name="parent_id" id="input-parent">
                                                    <option value="0">作为一级分类</option>
                                                    {$categories_tree}
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-name"><span class="form-required">*</span>分类名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" id="input-name" name="name">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-name">分类别名</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" id="input-alias" name="alias">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-description">描述</label>
                                            <div class="layui-input-block">
                                                <textarea class="layui-textarea" name="description" id="input-description"></textarea>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-description">首页推荐</label>
                                            <div class="layui-input-block" style="padding-top:9px;">
                                                <label class="lyear-checkbox checkbox-info">
                                                    <input type="checkbox" id="home_recommended-checkbox" name="home_recommended" value="1" lay-ignore>推荐
                                                    <span></span>
                                                </label>
                                                <span id="recommended-error" style="color: red;display: none"></span>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-description">缩略图</label>
                                            <div class="layui-input-block">
                                                <input type="hidden" name="more[thumbnail]" class="form-control"
                                                       id="js-thumbnail-input">
                                                <div>
                                                    <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
                                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                             id="js-thumbnail-input-preview"
                                                             width="135" style="cursor: pointer"/>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-seo_title">SEO标题</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" id="input-seo_title" name="seo_title">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-seo_keywords">SEO关键字</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" id="input-seo_keywords" name="seo_keywords">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-seo_description">SEO描述</label>
                                            <div class="layui-input-block">
                                                <textarea class="layui-textarea" name="seo_description" id="input-seo_description"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-tab-item">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-list_tpl"><span class="form-required">*</span>列表模板</label>
                                            <div class="layui-input-block">
                                                <select class="layui-input" name="list_tpl" id="input-list_tpl">
                                                    <!--<option value="list">portal/list.html(默认)</option>-->
                                                    <foreach name="list_theme_files" item="vo">
                                                        <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                        <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                                    </foreach>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label" for="input-one_tpl"><span class="form-required">*</span>文章模板</label>
                                            <div class="layui-input-block">
                                            <select class="layui-input" name="one_tpl" id="input-one_tpl">
                                                <!--<option value="article">portal/article.html(默认)</option>-->
                                                <foreach name="article_theme_files" item="vo">
                                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                                </foreach>
                                            </select>
                                        </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button type="submit" class="layui-btn js-ajax-submit js-ajax-submit">{:lang('ADD')}</button>
                                            <a class="layui-btn layui-btn-primary" href="{:url('AdminCategory/index')}">{:lang('BACK')}</a>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="public@script"/>
<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //JavaScript
        element.tab({
            headerElem: '#tabHeader>li' //指定tab头元素项
            ,bodyElem: '#tabBody>.layui-tab-item' //指定tab主体元素项
        });
    });
</script>
</body>
</html>